<template>
    <!--员工食宿-->
    <div class="introduce">
        <div>  
            <aui-list v-for="(item,index) in datas.list" :key="index" class="item" @click="viewDetail(item)" :style="{ 'background-image': 'url(' + item.image + ')','background-repeat':'no-repeat','background-size':'cover' }">
                <div class="contentArea">
                    <div class="campusDesc">{{ item.text }}</div>
                    <div class="campusDetail">{{ item.subText }}</div>
                </div>
            </aui-list>
        </div>
    </div>
</template>
<script>
//mock数据真实服务注释删除
import datas from '../../mock/employee/employee.js'
export default {
    data() {
        return {
           datas 
        }
    },
    created() {
        window.HWH5.setNavigationBarTitle({ title: this.$t('employeeLife')  });
        // 真实请求服务方法
        // const userId = this.$store.state.userInfo.userId
        // this.getDatas(userId)
    },
    methods: {
        //跳转至详情
        viewDetail(item) {
            if(item.type === 'dorms') {
                this.$router.push('./dorms')
            }
        },
        // 获取服务接口数据
        // getDatas(userId) {
        //   真实接口服务请求 需要将userInfo中的id作为参数传进去做数据请求
        //   const url = 'https://xxx?userId' + userId;
        //   const _headers = {
        //     'Content-Type': 'application/json'
        //   };
        //   HWH5.fetchInternet(url, {
        //     method: 'get',
        //     headers: _headers
        //   })
        //     .then(res => {
        //       res.json().then(reply => {
        //           //将接口返回数据赋值给热服务
        //           this.datas = reply
        //       });
        //     })
        //     .catch(error => {
        //       console.log('请求异常', error);
        //     });
        // }
    }
}
</script>  
<style lang="less" scoped>
.introduce {
    padding:12px 16px;
    height: 562px;
    background: #FFF9F9F9;
    .item {
        height: 120px;
        margin-bottom: 10px;
        .campusDesc {
            font-family: PingFangSC-Regular;
            font-size: 14px;
            color: #666666;
            letter-spacing: 0;
        }
        .contentArea {
            padding: 31px 0 30px 40px;
            .campusDesc {
                font-family: PingFangSC-Semibold;
                font-size: 24px;
                color: #FFFFFF;
                letter-spacing: 0;
            }
            .campusDetail {
                font-family: PingFangSC-Regular;
                font-size: 16px;
                color: #FFFFFF;
                letter-spacing: 0;
            }
        }
    }
}
</style>